home *** CD-ROM | disk | FTP | other *** search
/ Hacker's Arsenal - The Cutting Edge of Hacking / Hacker's Arsenal - The Cutting Edge of Hacking.iso / texts / nix / chmod.txt < prev    next >
Text File  |  2001-07-11  |  4KB  |  111 lines

  1.      _|_|_|  _|        _|     _| _|     _|  _|     _|    _|_|_|   _|      _|_|_|
  2.      _|      _|      _|  _|  _| _| _|  _| _| _|  _|  _|  _|   _|  _|      _|
  3.      _|_|    _|      _|_|_|  _|    _|  _|    _|  _|_|_|  _|_|_|   _|      _|_|
  4.      _|      _|      _|  _|  _|    _|  _|    _|  _|  _|  _|   _|  _|      _|
  5.      _|      _|_|_|  _|  _|  _|    _|  _|    _|  _|  _|  _|_|_|   _|_|_|  _|_|_|
  6.  
  7.  
  8.                   _|_|_|   _|  _|  _|_|_|  _|_|_|  _|_|_|  _|_|_|
  9.                   _|   _|  _|  _|  _|      _|      _|      _|
  10.                   _|_|_|   _|_|_|  _|_|    _|      _|_|    _|_|_|
  11.                   _|       _|  _|  _|      _|      _|          _|
  12.                   _|       _|  _|  _|_|_|  _|_|_|  _|_|_|  _|_|_|
  13.  
  14.  
  15.                  http://www.pheces.org
  16.         "The wise man doesn't give the right answers,
  17.             he poses the right questions." - Claude Levi-Strauss
  18.  
  19.  
  20. ÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷
  21.  
  22. Title:      |||| Linux Modes (chmod) ||||
  23.  
  24. Date:       July 18, 1999
  25. Author:     rootwurm
  26.  
  27. ÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷
  28.  
  29. the linux command prompt provides a whole lot of information right before your eyes.
  30. if you do a long listing of the files (ls -al) you'll see pretty much something like this:
  31.  
  32.     drwx--x---   4 root     root         1024 Jul 18 18:13 ./
  33.     drwxr-xr-x  21 root     root         1024 Jun 17 23:28 ../
  34.     -rw-r--r--   1 root     root         6543 Jul 18 19:15 .bash_history
  35.  
  36. taking this apart we get:
  37.  
  38. d rwx --x ---  4 root  root  1024  Jul 18 18:13  ./
  39. ^ ^^^ ^^^ ^^^  ^ ^^^^  ^^^^  ^^^^  ^^^^^^^^^^^^  ^^
  40. |  |   |   |   |  |     |     |         |        |
  41. |  |   |   |   |  |     |     |         |        the filename (or dir name)
  42. |  |   |   |   |  |     |     |         |
  43. |  |   |   |   |  |     |     |         the date the file was created (or modified)
  44. |  |   |   |   |  |     |     |
  45. |  |   |   |   |  |     |     the filesize
  46. |  |   |   |   |  |     |
  47. |  |   |   |   |  |     the group the file (or dir) belongs in)
  48. |  |   |   |   |  |
  49. |  |   |   |   |  the owner of the file (or dir)
  50. |  |   |   |   |
  51. |  |   |   |   the number of the files there are*
  52. |  |   |   |
  53. |  |   |   the permissions EVERYONE has on that file (or dir)
  54. |  |   |
  55. |  |   the permissions the group has
  56. |  |
  57. |  the permissions the owner of the file (or dir) has
  58. |
  59. it's a directory (notice .bash_history has no (d))
  60.  
  61.  
  62. * This i'm not really sure on yet.  It looks to me like, it tells how many dirs are in
  63.   the dir.  sounds confusing, but there are actually 4 dirs in ./, and 21 dirs in ../
  64.   beats me, but i've never had to use it.
  65.  
  66.  
  67. okay, with that understood, lets take a closer look at the file permissions (drwxr-xr-x)
  68.  
  69. if the first letter is a _d_, it means the filename is a directory.  if it's a - then its
  70. a normal file.
  71.  
  72. the next three letters (or dashes) concern the permissons the owner has, the following
  73. three are the permissions the group has, and the final three are the permsissions that
  74. everyone has.
  75.  
  76. there are four letters used in the file permissions:
  77.     d = directory
  78.         l = link  (kinda like a shortcut...a symbolic link pointing to a file or dir)
  79.     r = read
  80.     w = write
  81.     x = execute (for dirs, it means that person has access to it)
  82.  
  83. you've seen HOWTO's and INSTALL's and README's and most every Perl script that tells you to
  84. 'chmod 777 file'.  Well, so have i, but i've always wondered exactly what i'm doing.
  85.  
  86. the chmod command is formated like so: chmod 000 file(or dir) and the three numbers represent
  87. | 0 owner | 0 group | 0 everyone |
  88.  
  89. the chmod numbers correspond as follows:
  90.     1 = --x  (execute (or read access if its a dir)
  91.     2 = -w-  (write)
  92.     3 = -wx  (execute (access, for dirs) write)
  93.     4 = r--  (read only)
  94.     5 = r-x  (read execute or access for dirs :-)
  95.     6 = rw-  (read-write)
  96.     7 = rwx  (read-write-execute (or access)
  97.  
  98. so if you 'chmod 777 filename.txt', then the permissions become: -rwxrwxrwx
  99. if you 'chmod 400 filename.txt', the permissions become: -r--------
  100. if you 'chmod 634 filename.txt', the permissions become: -rw--wxr--
  101. and so on.
  102.  
  103. hope that helped you in understanding the prompt, permissions, and chmod.
  104.  
  105.  
  106.  
  107. later,
  108.  
  109. rootwurm
  110.  
  111. (((((((((((((((((((((((((((((((((((((((((((((#yep)))))))))))))))))))))))))))))))))))))))))))))